//
//  MineOrderAllCell.m
//  PaiLeXiongProject
//
//  Created by 小獾科技 on 2017/9/5.
//  Copyright © 2017年 小獾科技. All rights reserved.
//

#import "MineOrderAllCell.h"


@interface MineOrderAllCell ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *completeLabel;
@property (nonatomic, strong) UIImageView *imgView;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *numberLabel;
@property (nonatomic, strong) UILabel *currentPrice;
@property (nonatomic, strong) UILabel *originalPriceLabel;


@end
@implementation MineOrderAllCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
   if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
   {
       self.backgroundColor = COLOR_BACKGROUND;
       UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 10, GWIDTH, 124)];
       bgView.backgroundColor = ColorWhite;
       [self addSubview:bgView];
       
       _titleLabel = [UILabel new];
       _titleLabel.text = @"爱儿美儿童摄影";
       _titleLabel.textColor = ColorFrom16(0x333333);
       _titleLabel.font = PFRFONT(14);
       [bgView addSubview:_titleLabel];
       [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(bgView).offset(12);
           make.left.equalTo(bgView).offset(10);
           make.width.greaterThanOrEqualTo(@114);
           make.height.equalTo(@20);
       }];
       
       _completeLabel = [UILabel new];
       _completeLabel.text = @"交易完成";
       _completeLabel.textColor = ColorFrom16(0xF5CB37);
       _completeLabel.font = PFRFONT(14);
       [bgView addSubview:_completeLabel];
       [_completeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(bgView).offset(10);
           make.right.equalTo(bgView).offset(-12);
           make.width.equalTo(@56);
           make.height.equalTo(@20);
       }];
       
       UIView *line = [UIView new];
       line.backgroundColor = ColorFrom16(0xF0F0F0);
       [bgView addSubview:line];
       [line mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(_titleLabel.mas_bottom).offset(10.5);
           make.left.equalTo(bgView).offset(10);
           make.right.equalTo(bgView).offset(-10);
           make.height.equalTo(@1);
       }];
       
       _imgView = [UIImageView new];
       _imgView.image = IMAGE(@"");
       [bgView addSubview:_imgView];
       [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(line.mas_bottom).offset(10);
           make.left.equalTo(bgView).offset(10);
           make.width.equalTo(@60);
           make.height.equalTo(@60);
       }];
       
       _nameLabel = [UILabel new];
//       _nameLabel.text = @"爱儿美儿童女鞋秋季梦想儿童女鞋爱儿美儿童女鞋  橘色  13码";
       _nameLabel.textColor = ColorFrom16(0x323232);
       _nameLabel.font = PFRFONT(12);
       _nameLabel.numberOfLines = 2;
       [bgView addSubview:_nameLabel];
       [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(line.mas_bottom).offset(10);
           make.left.equalTo(_imgView.mas_right).offset(10);
           make.width.equalTo(@209);
           make.height.greaterThanOrEqualTo(@10);
       }];
       
       _numberLabel = [UILabel new];
       _numberLabel.text = @"数量  X1";
       _numberLabel.textColor = ColorFrom16(0x7F7E7D);
       _numberLabel.font = PFRFONT(12);
       [bgView addSubview:_numberLabel];
       [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(_nameLabel.mas_bottom).offset(9);
           make.left.equalTo(_imgView.mas_right).offset(10);
           make.width.greaterThanOrEqualTo(@80);
           make.height.equalTo(@17);
       }];
       
       _currentPrice = [UILabel new];
       _currentPrice.text = @"￥580.74";
       _currentPrice.textColor = ColorFrom16(0x202020);
       _currentPrice.font = PFRFONT(16);
       [bgView addSubview:_currentPrice];
       [_currentPrice mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(_nameLabel.mas_bottom).offset(4);
           make.right.equalTo(bgView).offset(-2);
           make.width.greaterThanOrEqualTo(@76);
           make.height.equalTo(@22);
       }];
       
       _originalPriceLabel = [UILabel new];
       _originalPriceLabel.text = @"￥610";
       _originalPriceLabel.textColor = ColorFrom16(0x999999);
       _originalPriceLabel.font = PFRFONT(14);
       _originalPriceLabel.attributedText = [GW_Tool setCutLine:_originalPriceLabel.text];
       [bgView addSubview:_originalPriceLabel];
       [_originalPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
           make.top.equalTo(_nameLabel.mas_bottom).offset(6);
           make.right.equalTo(_currentPrice.mas_left).offset(-10);
           make.width.greaterThanOrEqualTo(@37);
           make.height.equalTo(@20);
       }];
   
       
   }
    return self;
}


- (void)configViewWithModel:(AllOrderModel *)model
{
    _titleLabel.text = model.store_name;
    _completeLabel.text = model.status;
    [_imgView sd_setImageWithURL:[NSURL URLWithString:STRING(model.goods_img)] placeholderImage:nil];
    _nameLabel.text = model.goods_name;
    _numberLabel.text = [NSString stringWithFormat:@"数量 X%@", model.sum];
    _originalPriceLabel.text = [NSString stringWithFormat:@"￥%@", model.goods_price];
    _currentPrice.text = [NSString stringWithFormat:@"￥%@", model.sale_price];
    _originalPriceLabel.attributedText = [GW_Tool setCutLine:_originalPriceLabel.text];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
